package com.ljx.thread.thread02;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/10/31 16:12
 * @Version 1.0
 */
public class ThreadAnonymity {
	public static void main(String[] args) {
		// 第三种创建线程的方法
		Thread thread = new Thread(new Runnable() {
			@Override
			public void run() {
				for (int i = 0; i < 10; i++) {
					System.out.println(Thread.currentThread().getName()+"匿名线程的创建方式");
				}
			}
		});

		// 启动线程
		thread.start();

		for (int i = 0; i < 10; i++) {
			System.out.println(Thread.currentThread().getName()+"主线程");
		}
	}
}
